package com.mujin.keji.collectionsystem.module.outboundtask.viewmodel;

import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.ViewModel;

import com.mujin.keji.collectionsystem.base.BaseDto;
import com.mujin.keji.collectionsystem.module.outboundtask.dto.CaseInfoDto;
import com.mujin.keji.collectionsystem.module.outboundtask.dto.LabelsDto;
import com.mujin.keji.collectionsystem.module.outboundtask.repository.CaseInfoRepository;
import com.mujin.keji.collectionsystem.module.outboundtask.repository.ICaseInfoRepository;
import com.mujin.keji.collectionsystem.module.outboundtask.repository.ILabelsRepository;
import com.mujin.keji.collectionsystem.module.outboundtask.repository.LabelsRepository;
import com.mujin.keji.collectionsystem.module.outboundtask.vo.CaseInfoVo;
import com.mujin.keji.collectionsystem.module.outboundtask.vo.LabelVo;

/**
 * 案件信息viewmodel
 *
 * @author weishixiong
 * @Time 2018-05-11
 */
public class CaseInfoViewModel extends ViewModel {
    private LiveData<BaseDto<CaseInfoDto>> liveData;
    private ICaseInfoRepository caseInfoRepository;
    /**
     * 催记标签
     */
    private LiveData<BaseDto<LabelsDto>> labelLiveData;
    private ILabelsRepository labelsRepository;
    /**
     * 查询催记标签
     *
     * @param caseManageId
     * @return
     */
    public LiveData<BaseDto<LabelsDto>> getLabelLiveData(String caseManageId) {
        LabelVo vo = new LabelVo(caseManageId);
        labelsRepository = new LabelsRepository();
        this.labelLiveData = labelsRepository.queryLabels(vo);
        return labelLiveData;
    }
    public LiveData<BaseDto<CaseInfoDto>> getLiveData(Long applyId, String caseCode) {
        queryCaseInfo(applyId, caseCode);
        return liveData;
    }

    /**
     * @param applyId
     * @param caseCod
     */
    public void queryCaseInfo(Long applyId, String caseCod) {
        CaseInfoVo vo = new CaseInfoVo(applyId, caseCod);
        caseInfoRepository = new CaseInfoRepository();
        this.liveData = caseInfoRepository.queryCaseInfo(vo);

    }
}
